$(function () {
   obj.init();
});
var obj = new function () {
    'use strict';
    return {
        form:null,
        id:null,
        init:function () {
            this.id = xhTool.getQuery('id');
            $('#template').select2();
            this.funObj().loadWidth();
            this.listener();
        },
        listener:function () {
            var $this = this;

            //模板选中
            $('#template').change(function () {
                var val = $('[name=content]').val();
                $('[name=content]').val(val+$(this).val());
            });
            
            $('#replyBtn').click(function () {
                $this.funObj().submitForm();
            })

        },
        funObj:function () {
            var $this = this;
            return {
                submitForm:function () {
                    var content = $('[name=content]').val();
                    xhExtra.ajaxRequest('feedback/replyFeedBack', {id:$this.id,content:content},{},function (res) {
                        window.top.xhTop.showSuccess(res.msg);
                        window.top.xhTop.getActiveFrame().obj.dataGrid.reload();
                        window.top.xhTop.getActiveFrame().obj.funObj().successEastPanel();
                        window.top.xhTop.closeModal();
                    })
                },
                loadWidth:function () {
                    var height = $(document.body).outerHeight(true) - 20;
                    $('.scrollDiv').attr('style','height:'+height+'px');
                    window.onresize = function(){  //重新定义界面大小处理
                        var height = $(document.body).outerHeight(true) - 20;
                        $('.scrollDiv').attr('style','height:'+height+'px');
                    };
                }
            }
        }
    }
};
